package own.stu.jobgib.playown.fsm.easyStates.core;

import own.stu.jobgib.playown.fsm.easyStates.api.Event;
import own.stu.jobgib.playown.fsm.easyStates.api.EventHandler;
import own.stu.jobgib.playown.fsm.easyStates.api.State;

public class TransitionBuilder {

    private TransitionImpl transition;

    public TransitionBuilder() {
        transition = new TransitionImpl();
    }

    public TransitionBuilder name(String name) {
        transition.setName(name);
        return this;
    }

    public TransitionBuilder sourceState(State sourceState) {
        transition.setSourceState(sourceState);
        return this;
    }

    public TransitionBuilder targetState(State targetState) {
        transition.setTargetState(targetState);
        return this;
    }

    public TransitionBuilder eventType(Class<? extends Event> eventType) {
        transition.setEventType(eventType);
        return this;
    }

    public <E extends Event> TransitionBuilder eventHandler(EventHandler<E> eventHandler) {
        transition.setEventHandler(eventHandler);
        return this;
    }

    public TransitionImpl builder() {
        return transition;
    }
}
